<?php

namespace App\Admin\Eloquent;


class ProjectTypeTemplate extends Model
{
    protected $fillable = ['name', 'interest_calculation', 'description', 'transaction_record'];

    /**
     * 根据模板名称模糊查询模板
     *
     * @param array $args
     * @param int $pagesize
     * @return mixed
     */
    public static function paging_query(array $args, int $pagesize = 15)
    {
        $query = ProjectTypeTemplate::query();

        if(!empty($args['name']))
            $query = $query->where('name','like','%'.$args['name'].'%');


        $project_type_templates = $query->orderBy('updated_at','desc')->paginate($pagesize);

        return $project_type_templates;
    }
}